from app.dao.base import BaseDao
from app.schema.ai import AiInfoSchema,AiUpdateSchema

from ..model.ai import Ai
class AiDao(BaseDao):

    Model = Ai
    
    def read_by_user_id(self, user_id: str) -> Ai:
        return self.db.sess.query(Ai).filter(
            Ai.user_id == user_id, 
            Ai.is_deleted == 0,
        ).first()
    

    def search_by_ai_id(self, ai_id:int):
        return self.db.sess.query(Ai).filter(
            Ai.id == ai_id,
            Ai.is_deleted == 0
        ).first()
    
    def get_all_ai(self):
        return self.db.sess.query(Ai).filter(
            Ai.is_deleted == 0
        ).all()